import router from '@/router'
import { getToken } from './auth'
// import el from 'element-ui/src/locale/lang/el'

// const white = ['/login']

router.beforeEach((to, from, next) => {
  if (getToken()) {
    next()
  } else {
    if (to.path === '/login') {
      next()
    } else {
      next('/login')
    }
  }
})

router.afterEach((to, from, next) => {
  window.scrollTo(0, 0)
})
